package com.example.online_exam_system.commons;

/**
 * @author lianglong
 * @create 2021-11-27-16:03
 * @describe
 */
public class TableResult {
    private boolean success;
    private String msg;
    private int code;
    private Object data;
    private String count;

    public String getCount() {
        return count;
    }

    public void setCount(String count) {
        this.count = count;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public TableResult data(Object data){
        this.data=data;
        return this;
    }


    public TableResult msg(String msg){
        this.msg=msg;
        return this;
    }

    public TableResult code(int code){
        this.code=code;
        return this;
    }

    public TableResult count(String count){
        this.count=count;
        return this;
    }
    public TableResult success(boolean success){
        this.success=success;
        return this;
    }

    public static TableResult ok(){
        TableResult tableResult = new TableResult();
        tableResult.setCode(0);
        tableResult.setSuccess(true);
        return tableResult;
    }

    public static TableResult err(){
        TableResult tableResult = new TableResult();
        tableResult.setCode(1);
        tableResult.setSuccess(false);
        return tableResult;
    }
}
